<template>
  <div class="playlist-comment-item">
    <!-- 头像 -->
    <div class="left">
      <img :src="item.user.avatarUrl | completeImageUrl" alt="" />
    </div>

    <!-- 信息 -->
    <div class="right">
      <div class="top">
        <!-- 用户名 -->
        <div class="left">
          <div class="nick">{{ item.user.nickname }}</div>

          <!-- 发布时间&地址 -->
          <div class="time">
            {{ item.timeStr }} · {{ item.ipLocation.location }}
          </div>
        </div>

        <!-- 评论点赞数 -->
        <div class="right">
          <div class="num" v-if="item.likedCount">{{ item.likedCount }}</div>
          <div class="icon icon_base"></div>
        </div>
      </div>

      <div class="middle">{{ item.content }}</div>

      <div class="bottom">{{ item.beReplied.length }}条回复 &gt;</div>

      <div class="replied" v-if="item.beReplied">
        <!-- 头像 -->
        <div class="left">
          <img
            :src="item.beReplied[0].user.avatarUrl | completeImageUrl"
            alt=""
          />
        </div>

        <!-- 信息 -->
        <div class="right">
          <div class="top">
            <!-- 用户名 -->
            <div class="left">
              <div class="nick">{{ item.beReplied[0].user.nickname }}</div>

              <!-- 发布时间&地址 -->
              <div class="time">
                {{ item.beReplied[0].ipLocation.location }}
              </div>
            </div>

            <!-- 评论点赞数 -->
            <div class="right">
              <div class="icon icon_base"></div>
            </div>
          </div>

          <div class="middle">{{ item.beReplied[0].content }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "PlayListCommentItem",
  components: {},
  props: {
    item: Object,
  },
};
</script>

<style lang="less" scoped>
.playlist-comment-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin-bottom: 30px;

  & > .left {
    width: 40px;
    height: 100%;

    img {
      border-radius: 50%;
    }
  }

  & > .right {
    flex: 1;
    padding-left: 10px;
    position: relative;

    & > .top {
      width: 100%;
      height: 40px;
      display: flex;
      justify-content: space-between;
      align-items: center;

      & > .left {
        & > .nick {
          font-weight: bold;
          font-size: 14px;
        }

        & > .time {
          font-size: 12px;
          color: #707070;
        }
      }

      & > .right {
        height: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;

        & > .num {
          font-size: 14px;
          color: #707070;
        }

        & > .icon {
          width: 40px;
          height: 100%;
          background-image: url("@/assets/点赞.png");
        }
      }
    }

    & > .bottom {
      font-size: 12px;
      color: #567b9c;
    }

    & > .replied {
      background-color: #eeeeee;
      font-size: 12px;
      display: flex;

      & > .left {
        width: 30px;
        height: 100%;

        img {
          border-radius: 50%;
        }
      }

      & > .right {
        flex: 1;
        padding-left: 15px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;

        & > .top {
          width: 100%;
          height: 40px;
          display: flex;
          justify-content: space-between;
          align-items: center;

          & > .left {
            & > .nick {
              font-weight: bold;
              font-size: 14px;
            }

            & > .time {
              font-size: 12px;
              color: #707070;
            }
          }

          & > .right {
            height: 100%;
            display: flex;
            justify-content: space-between;
            align-items: center;

            & > .num {
              font-size: 14px;
              color: #707070;
            }

            & > .icon {
              width: 40px;
              height: 100%;
              background-image: url("@/assets/点赞.png");
            }
          }
        }

        & > .bottom {
          font-size: 12px;
          color: #567b9c;
        }
      }
    }

    &::after {
      content: "";
      width: 100%;
      height: 2px;
      background-color: #7070706b;
      position: absolute;
      bottom: -15px;
      display: block;
    }
  }

  &:last-of-type {
    & > .right {
      &::after {
        content: "";
        background-color: transparent;
      }
    }
  }
}
</style>
